package com.taobao.tools;

import java.util.Date;

import org.eclipse.jface.action.StatusLineManager;

import com.swtdesigner.SWTResourceManager;

public class TBStatusLineManager extends StatusLineManager {
	private long messageId;

	public void setAutoErrorMessage(String message) {
		setErrorMessage(message);
		ClearMessageThread clearMessageThread = new ClearMessageThread(getControl().getDisplay(), messageId);
		clearMessageThread.start();
	}

	public void setAutoMessage(String message) {
		setMessage(message);
		ClearMessageThread clearMessageThread = new ClearMessageThread(getControl().getDisplay(), messageId);
		clearMessageThread.start();
	}
	
	public void setMessage(String message){
		messageId = new Date().getTime();
		super.setMessage(SWTResourceManager.getImageForPath("success.png"), message);
	}
	
	public void setErrorMessage(String message) {
		messageId = new Date().getTime();
		super.setMessage(SWTResourceManager.getImageForPath("error.png"), message);
	}

	public void clearMessage(){
		super.setMessage(null);
	}
	
	public long getMessageId() {
		return messageId;
	}

}
